package com.bm.server.controller;


import com.bm.server.dto.DogkillDto;
import com.bm.server.service.intf.DogkillService;
import com.bm.server.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
 * |                     ______                     |
 * |                  .-"      "-.                  |
 * |                 /            \                 |
 * |     _          |              |          _     |
 * |    ( \         |,  .-.  .-.  ,|         / )    |
 * |     > "=._     | )(__/  \__)( |     _.=" <     |
 * |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |
 * |           "=._"(_     ^^     _)"_.="           |
 * |               "=\__|IIIIII|__/="               |
 * |              _.="| \IIIIII/ |"=._              |
 * |    _     _.="_.="\          /"=._"=._     _    |
 * |   ( \_.="_.="     `--------`     "=._"=._/ )   |
 * |    > _.="                            "=._ <    |
 * |   (_/                                    \_)   |
 * |                                                |
 * '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='
 * -----------------代码的搬运工-----------------
 *
 * @Date: 2022/07/21/14:09
 */
@RestController
@RequestMapping("/api/dogkill")
@Api(tags = "狼人杀房间操作-谢英凡")
@CrossOrigin
public class DogkillController {
    @Resource
    private DogkillService service;
    @GetMapping("selectnums.do")
    @ApiOperation(value = "查询房间的人数")
    public R selectnums(@RequestParam int roomid){
        return service.countuid(roomid);
    }
    @PostMapping("save.do")
    @ApiOperation(value = "用户点击加入房间")
    public R save(@RequestBody DogkillDto dto){
        return service.save(dto);
    }
    @PostMapping("outroom.do")
    @ApiOperation(value = "用户退出房间")
    public R outroom(@RequestBody DogkillDto dto){
        return service.deleteByUid(dto);
    }
    @GetMapping("gameStart.do")
    @ApiOperation(value = "游戏开始分配身份")
    public R gameStart(@RequestParam int roomid){
        return service.gameStart(roomid);
    }
    @GetMapping("selectByname")
    @ApiOperation(value = "查看自己的身份或者预言家查询别人身份")
    public R selectByname(@RequestParam int uid){
        return service.selectByUid(uid);
    }
    @GetMapping("wolfkillpeople")
    @ApiOperation(value = "狼人通过用户id杀人")
    public R wolfkillpeople(@RequestParam int uid){
        return service.wolfkillpeople(uid);
    }
    @GetMapping("nvwusave.do")
    @ApiOperation(value = "判断女巫是否有解药并选择是否救人")
    public R nvwusave(int roomid,String save){
        return service.nvwusave(roomid, save);
    }
    @GetMapping("nvwukill.do")
    @ApiOperation(value = "判断女巫是否有毒药并选择是否毒人")
    public R nvwukill(int roomid, String kill,int uid){
        return service.nvwukill(roomid, kill, uid);
    }
    @GetMapping("deleteByid.do")
    @ApiOperation(value = "执行死亡接口并判断是不是猎人")
    public R deleteByid(@RequestParam int roomid,@RequestParam int uid){
        return service.deleteByid(roomid, uid);
    }
    @GetMapping("isgameoverhao.do")
    @ApiOperation(value = "判断好人是否胜利，狼人死完")
    public R isgameoverhao(int roomid){
        return service.isgameoverhao(roomid);
    }
    @GetMapping("isgameoverhuai1.do")
    @ApiOperation(value = "判断狼人是否胜利条件1，平民死完")
    public R isgameoverhuai1(int roomid){
        return service.isgameoverhuai1(roomid);
    }
    @GetMapping("isgameoverhuai2.do")
    @ApiOperation(value = "判断狼人是否胜利2，神死完")
    public R isgameoverhuai2(int roomid){
        return service.isgameoverhuai2(roomid);
    }
    @ApiOperation(value = "选择用户投票")
    @GetMapping("toupiao.do")
    public R toupiao(int roomid,int uid){
        return service.toupiao(roomid, uid);
    }
}
